package com.steakliu.sun.invoker;

import com.steakliu.sun.invoker.api.Invoker;
import com.steakliu.sun.invoker.api.InvokerConfig;
import com.steakliu.sun.spi.annotation.Join;

import java.lang.reflect.Method;

/**
 * 功能说明：
 * <p>
 * Original @Author: steakliu-刘牌, 2023-01-08  14:41
 * <p>
 * Copyright (C)2020-2022  steakliu All rights reserved.
 */
@Join
public class JdkInvoker implements Invoker {

    @Override
    public Object invoke(Object serviceBean, Class<?> clazz, String methodName, Class<?>[] parameterTypes, Object[] parameters) throws Exception {
        Method method = clazz.getMethod(methodName, parameterTypes);
        method.setAccessible(true);
        return method.invoke(serviceBean, parameters);
    }
}
